package edu.gmu.cs;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import com.facebook.android.*;
import com.facebook.android.AsyncFacebookRunner.RequestListener;
import com.facebook.android.Facebook.*;

public class MyAndriodApp3Activity extends Activity {

	    Facebook facebook = new Facebook("285831814778676");
	    AsyncFacebookRunner mAsyncRunner = new AsyncFacebookRunner(facebook);
	    RequestListener listener;

	    @Override
	    public void onCreate(Bundle savedInstanceState) {
	        super.onCreate(savedInstanceState);
	        setContentView(R.layout.main);

	        facebook.authorize(this, new DialogListener() {
	            @Override
	            public void onComplete(Bundle values) {}

	            @Override
	            public void onFacebookError(FacebookError error) {}

	            @Override
	            public void onError(DialogError e) {}

	            @Override
	            public void onCancel() {}
	        });
	    }

	    @Override
	    public void onActivityResult(int requestCode, int resultCode, Intent data) {
	        super.onActivityResult(requestCode, resultCode, data);

	        facebook.authorizeCallback(requestCode, resultCode, data);
	        // get the posts made by the "platform" page
	        mAsyncRunner.request("platform/posts", listener);
	        
	        /*
	        //post on user's wall.
	        facebook.dialog(context, "feed", new PostDialogListener());
	        
	        //post on friend's wall.
	        Bundle params = new Bundle();
	        params.putString("to", "");
	        facebook.dialog(context, "feed", params, new PostDialogListener());
	        */
	    }
}